<template>
  <div v-if="!isDD">
    <div class="main_header">
      <i class="back_icon" v-if="showBack" @click="goBack"></i>
      <div class="content">{{ title || $route.meta.title || "" }}</div>
      <slot />
    </div>
    <div class="header_block"></div>
  </div>
</template>

<script>
import { mapState } from "vuex";
export default {
  name: "Declare",
  props: {
    title: {
      type: String,
      default: ""
    },
    showBack: {
      type: Boolean,
      default: true
    }
  },
  data() {
    return {};
  },
  computed: {
    ...mapState({
      isDD: state => state.user.is_dd
    })
  },
  methods: {
    goBack() {
      history.go(-1);
    }
  }
};
</script>

<style scoped>
.main_header {
  width: 100%;
  height: 50px;
  color: #333;
  font-size: 16px;
  position: fixed;
  background-color: #fff;
  z-index: 99;
}
.main_header .back_icon {
  width: 20px;
  height: 20px;
  background: url("../../assets/common/arrow-back.png") no-repeat;
  background-size: 100% 100%;
  position: absolute;
  left: 10px;
  top: 15px;
  cursor: pointer;
}
.main_header .content {
  width: 100%;
  height: 50px;
  line-height: 50px;
  text-align: center;
}
.header_block {
  height: 50px;
  width: 100%;
}
</style>
